
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>BlockCanary · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="fresco.html" />
    
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../">
            
                <a href="../">
            
                    
                    Android
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" >
            
                <span>
            
                    
                    框架
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.2.1.1" data-path="BlockCanary.html">
            
                <a href="BlockCanary.html">
            
                    
                    BlockCanary
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="fresco.html">
            
                <a href="fresco.html">
            
                    
                    Fresco
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="Glide源码.html">
            
                <a href="Glide源码.html">
            
                    
                    Glide
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4" data-path="LeakCanary原理.html">
            
                <a href="LeakCanary原理.html">
            
                    
                    LeakCanary
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.5" data-path="Retrofit源码.html">
            
                <a href="Retrofit源码.html">
            
                    
                    Retrofit源码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" >
            
                <span>
            
                    
                    源码解析
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../源码/Binder.html">
            
                <a href="../源码/Binder.html">
            
                    
                    Binder
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="../源码/Dialog源码.html">
            
                <a href="../源码/Dialog源码.html">
            
                    
                    Dialog源码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.3" data-path="../源码/RecycleView缓存机制.html">
            
                <a href="../源码/RecycleView缓存机制.html">
            
                    
                    RecycleView缓存机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.4" data-path="../源码/WMS源码.html">
            
                <a href="../源码/WMS源码.html">
            
                    
                    WMS源码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" >
            
                <span>
            
                    
                    自定义View及效果
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.3.1" data-path="../自定义View及效果/触摸事件.html">
            
                <a href="../自定义View及效果/触摸事件.html">
            
                    
                    触摸事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.2" data-path="../自定义View及效果/自定义ItemDecoration.html">
            
                <a href="../自定义View及效果/自定义ItemDecoration.html">
            
                    
                    自定义ItemDecoration
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.3" data-path="../自定义View及效果/ItemTouchHelper使用.html">
            
                <a href="../自定义View及效果/ItemTouchHelper使用.html">
            
                    
                    ItemTouchHelper
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.4" data-path="../自定义View及效果/MaterilaDesign布局使用.html">
            
                <a href="../自定义View及效果/MaterilaDesign布局使用.html">
            
                    
                    MaterilaDesign布局使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.4" >
            
                <span>
            
                    
                    Gradle
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.4.1" data-path="../Gradle/Gradle编译流程梳理.html">
            
                <a href="../Gradle/Gradle编译流程梳理.html">
            
                    
                    Gradle编译流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.2" data-path="../Gradle/Transform使用.html">
            
                <a href="../Gradle/Transform使用.html">
            
                    
                    Transform使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.5" >
            
                <span>
            
                    
                    kotlin实践
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.5.1" data-path="../Kotlin/协程使用.html">
            
                <a href="../Kotlin/协程使用.html">
            
                    
                    协程初步使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../java/">
            
                <a href="../../java/">
            
                    
                    Java
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../java/多线程同步.html">
            
                <a href="../../java/多线程同步.html">
            
                    
                    多线程同步
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../../java/垃圾回收机制.html">
            
                <a href="../../java/垃圾回收机制.html">
            
                    
                    垃圾回收机制
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../计算机网络/">
            
                <a href="../../计算机网络/">
            
                    
                    计算机网络
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../计算机网络/编码加密.html">
            
                <a href="../../计算机网络/编码加密.html">
            
                    
                    编码加密算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../计算机网络/登陆认证.html">
            
                <a href="../../计算机网络/登陆认证.html">
            
                    
                    登陆认证流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../../计算机网络/http协议.html">
            
                <a href="../../计算机网络/http协议.html">
            
                    
                    http协议
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../../操作系统/">
            
                <a href="../../操作系统/">
            
                    
                    操作系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    设计模式
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../设计模式/单例模式.html">
            
                <a href="../../设计模式/单例模式.html">
            
                    
                    单例模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../../设计模式/建造者模式.html">
            
                <a href="../../设计模式/建造者模式.html">
            
                    
                    建造者模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >BlockCanary</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="blockcanary&#x539F;&#x7406;">BlockCanary&#x539F;&#x7406;</h2>
<pre><code>- &#x5982;&#x4F55;&#x68C0;&#x6D4B;&#x8017;&#x65F6;&#xFF1A;
    1&#x3001;&#x901A;&#x8FC7;&#x4F7F;&#x7528;Looper.getMainLooper().setMessageLogging&#x65B9;&#x6CD5;&#x6355;&#x6349;Printer&#x5728;Looper&#x7684;loop&#x65B9;&#x6CD5;&#x4E2D;&#x5BF9;&#x6BCF;&#x4E2A;message&#x7684;&#x5206;&#x6D3E;&#x5904;&#x7406;&#x524D;&#x540E;&#x7684;&#x6253;&#x5370;&#x65F6;&#x673A;&#x8BB0;&#x5F55;&#x6BCF;&#x4E2A;message&#x7684;&#x5904;&#x7406;&#x8017;&#x65F6;&#xFF0C;&#x901A;&#x8FC7;&#x6253;&#x5370;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x533A;&#x5206;&#x5F00;&#x59CB;&#x524D;&#x540E;&#x3002;
    2&#x3001;&#x8FD8;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x7F16;&#x821E;&#x8005;Choreographer&#x7684;&#x6BCF;&#x4E00;&#x5E27;&#x56DE;&#x8C03;&#x65B9;&#x6CD5;&#x8BB0;&#x5F55;&#x8017;&#x65F6;&#x3002;
- &#x5982;&#x4F55;&#x627E;&#x5230;&#x65B9;&#x6CD5;&#x8017;&#x65F6;&#x70B9;&#xFF1A;
    1&#x3001;&#x901A;&#x8FC7;Thread.currentThread.getStackTrace&#x65B9;&#x6CD5;&#x5C06;&#x6BCF;&#x4E2A;&#x8C03;&#x7528;&#x6808;&#x6253;&#x5370;&#x51FA;&#x6765;&#x3002;
</code></pre><h2 id="&#x5982;&#x4F55;&#x8F85;&#x52A9;&#x627E;&#x5230;&#x8017;&#x65F6;&#x70B9;&#xFF08;&#x5DE5;&#x5177;&#xFF09;">&#x5982;&#x4F55;&#x8F85;&#x52A9;&#x627E;&#x5230;&#x8017;&#x65F6;&#x70B9;&#xFF08;&#x5DE5;&#x5177;&#xFF09;:</h2>
<pre><code>- 1&#x3001;&#x901A;&#x8FC7;Debug.startMethodTracing&#x65B9;&#x6CD5;&#x548C;Debug.stopMethodTracing&#x65B9;&#x6CD5;&#x751F;&#x6210;track&#x6587;&#x4EF6;&#xFF0C;&#x67E5;&#x770B;&#x7ED8;&#x5236;&#x8017;&#x65F6;&#x70B9;&#xFF08;&#x4F46;&#x662F;&#x8BE5;&#x65B9;&#x6CD5;&#x6709;&#x8BEF;&#x5DEE;&#xFF0C;&#x5BF9;&#x6027;&#x80FD;&#x6709;&#x5F71;&#x54CD;&#xFF09;
- 2&#x3001;&#x901A;&#x8FC7;Trace.beginSection&#x65B9;&#x6CD5;&#x548C;Trace.endSection&#x65B9;&#x6CD5;&#x6253;&#x5F00;&#x76D1;&#x63A7;&#xFF0C;&#x518D;&#x901A;&#x8FC7;sdk&#x5DE5;&#x5177;&#x5305;&#x4E0B;platform-tools/systrace&#x7684;systrace.py&#x811A;&#x672C;&#x751F;&#x6210;html&#x6587;&#x4EF6;&#x3002;
     &#x6216;&#x8005;&#x901A;&#x8FC7;&#x624B;&#x673A;&#x7684;&#x8BBE;&#x7F6E;&#x4E2D;&#x7684;System Tracing&#x65B9;&#x6CD5;&#x751F;&#x6210;&#x6587;&#x4EF6;&#x518D;&#x5230;&#x5B98;&#x7F51;&#x89E3;&#x6790;&#xFF08;&#x6216;&#x8005;systrace --from-file trace-file-name.ctrace&#xFF09;&#x3002;
</code></pre><h4 id="&#x5C0F;&#x77E5;&#x8BC6;&#x70B9;&#xFF1A;">&#x5C0F;&#x77E5;&#x8BC6;&#x70B9;&#xFF1A;</h4>
<pre><code>- &#x4F18;&#x5316;&#x65E5;&#x5FD7;&#x8F93;&#x51FA;&#xFF1A;&#x901A;&#x8FC7;Timber.plant&#x65B9;&#x6CD5;&#x5BF9;&#x65E5;&#x5FD7;&#x8FDB;&#x884C;&#x683C;&#x5F0F;&#x5316;&#x3001;&#x8FD8;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x70B9;&#x65E5;&#x5FD7;&#x8DF3;&#x8F6C;&#x5BF9;&#x5E94;&#x4EE3;&#x7801;&#x5904;&#x3002;
</code></pre><p>&#x200B;    </p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                
                <a href="fresco.html" class="navigation navigation-next navigation-unique" aria-label="Next page: Fresco">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"layout":"post","title":"BlockCanary","subtitle":"界面耗时检测","date":"2020-12-12T23:27:00.000Z","author":"hzy","//header-img":"img/post-bg-2015.jpg","catalog":true,"tags":["三方库","渲染优化"],"level":"1.2.1.1","depth":3,"next":{"title":"Fresco","level":"1.2.1.2","depth":3,"path":"android/框架/fresco.md","ref":"android/框架/fresco.md","articles":[]},"previous":{"title":"框架","level":"1.2.1","depth":2,"ref":"","articles":[{"title":"BlockCanary","level":"1.2.1.1","depth":3,"path":"android/框架/BlockCanary.md","ref":"android/框架/BlockCanary.md","articles":[]},{"title":"Fresco","level":"1.2.1.2","depth":3,"path":"android/框架/fresco.md","ref":"android/框架/fresco.md","articles":[]},{"title":"Glide","level":"1.2.1.3","depth":3,"path":"android/框架/Glide源码.md","ref":"android/框架/Glide源码.md","articles":[]},{"title":"LeakCanary","level":"1.2.1.4","depth":3,"path":"android/框架/LeakCanary原理.md","ref":"android/框架/LeakCanary原理.md","articles":[]},{"title":"Retrofit源码","level":"1.2.1.5","depth":3,"path":"android/框架/Retrofit源码.md","ref":"android/框架/Retrofit源码.md","articles":[]}]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"android/框架/BlockCanary.md","mtime":"2021-03-11T15:16:09.310Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-03-13T16:08:39.790Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

